package projetolp2.GraphicInterface;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class SugestoesTipo  extends MealPoints implements ActionListener{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel panelMenu = new JPanel(new BorderLayout());
	private JButton CANTINA = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getCantina());
	private JButton RESTAURANTE = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getRestaurante());
	private JButton BOTECO = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getboteco());
	private JButton INDEFINIDO = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getIndefinido());
	private JButton VOLTAR = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getVoltar());	
	private JPanel panel0= new JPanel(new GridLayout(0, 1));
	private JPanel panel1= new JPanel(new GridLayout(0, 1));
	private JPanel panel2= new JPanel(new GridLayout(0, 1));
	private JPanel panel3= new JPanel(new GridLayout(0, 1));
	private JPanel panel4= new JPanel(new GridLayout(0, 1));
	final JLabel label = new JLabel("Escolha o tipo sugestao: ");
	private JPanel panelFinal = new JPanel();
	
	public SugestoesTipo(){
		
	}
	private void ajudaDeBotoes(){
		CANTINA.setToolTipText("Sugest�es do tipo cantina");
		RESTAURANTE.setToolTipText("Sugest�es do tipo restaurante");
		BOTECO.setToolTipText("Sugest�es do tipo boteco");
		INDEFINIDO.setToolTipText("Sugest�es sem tipo definido");
		VOLTAR.setToolTipText("Voltar a janela anterior");
	}
	
	public void actionPerformed(ActionEvent e){
		if(e.getSource() == VOLTAR){
			removerAdicionar(sugestoesTipo,sugestoespersonalizadas);	
		}
		else if(e.getSource() == RESTAURANTE){
			janela.setEnabled(false);
			quantidadeSugestoes.abilitaDesabilita(true, "RE");
		}
		else if(e.getSource() == CANTINA){
			janela.setEnabled(false);
			quantidadeSugestoes.abilitaDesabilita(true, "CA");
		}
		else if(e.getSource() == BOTECO){
			janela.setEnabled(false);
			quantidadeSugestoes.abilitaDesabilita(true, "BU");
		}
		else if(e.getSource() == INDEFINIDO){
			janela.setEnabled(false);
			quantidadeSugestoes.abilitaDesabilita(true, "IN");
		}
    }
	private void createComponents() {
		ajudaDeBotoes();
		
		CANTINA.setMnemonic(KeyEvent.VK_I);
		CANTINA.addActionListener(this);
        label.setLabelFor(CANTINA);

		RESTAURANTE.setMnemonic(KeyEvent.VK_I);
		RESTAURANTE.addActionListener(this);
        label.setLabelFor(RESTAURANTE);

		BOTECO.setMnemonic(KeyEvent.VK_I);
		BOTECO.addActionListener(this);
        label.setLabelFor(BOTECO);

		INDEFINIDO.setMnemonic(KeyEvent.VK_I);
		INDEFINIDO.addActionListener(this);
        label.setLabelFor(INDEFINIDO);
        
        VOLTAR.setMnemonic(KeyEvent.VK_I);
        VOLTAR.addActionListener(this);
        label.setLabelFor(VOLTAR);
        
        panel0.add(CANTINA);
        panel1.add(RESTAURANTE);
        panel2.add(BOTECO);
        panel3.add(INDEFINIDO);
        panel4.add(VOLTAR);
        panel0.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel1.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel2.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel3.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel4.setBorder(BorderFactory.createEmptyBorder(
        		5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panelFinal.add(panel0);
        panelFinal.add(panel1);
        panelFinal.add(panel2);
        panelFinal.add(panel3);
        panelFinal.add(panel4);
        panelMenu.add(panelFinal,BorderLayout.NORTH);
	}
	public Component panel(){
		createComponents();
		panelMenu.setVisible(true);
		
		
		return panelMenu;
	}	
}
